package com.shiro.receiver.framework.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum BotEventType {

    GROUP_AT_MESSAGE_CREATE(    "GROUP_AT_MESSAGE_CREATE",  "收到群聊消息"),
    C2C_MESSAGE_CREATE(         "C2C_MESSAGE_CREATE",       "收到单聊消息"),

    GROUP_ADD_ROBOT(            "GROUP_ADD_ROBOT",          "机器人被添加到群聊"),
    GROUP_DEL_ROBOT(            "GROUP_DEL_ROBOT",          "机器人被移出群聊"),
    GROUP_MSG_REJECT(           "GROUP_MSG_REJECT",         "群管理员主动在机器人资料页操作关闭通知"),
    GROUP_MSG_RECEIVE(          "GROUP_MSG_RECEIVE",        "群管理员主动在机器人资料页操作开启通知"),

    FRIEND_ADD(                 "FRIEND_ADD",               "用户添加机器人'好友'到消息列表"),
    FRIEND_DEL(                 "FRIEND_DEL",               "用户删除机器人'好友'"),
    C2C_MSG_REJECT(             "C2C_MSG_REJECT",           "用户在机器人资料卡手动关闭'主动消息'推送"),
    C2C_MSG_RECEIVE(            "C2C_MSG_RECEIVE",          "用户在机器人资料卡手动开启'主动消息'推送开关"),
    ;

    private final String value;
    private final String desc;

    private static final Map<String, BotEventType> ENUM_MAP = new HashMap<>();

    static {
        for (BotEventType botEventType : values()) {
            ENUM_MAP.put(botEventType.getValue(), botEventType);
        }
    }

    public static BotEventType getEventTypeByValue(String value) {
        return ENUM_MAP.get(value);
    }

}
